<?php
if (!defined('APP_ID')) { die('No direct script access allowed'); }

/**
 * Uri class
 */
class Uri {
	/**
	 * Get segment
	 */
	public function getSegment($num, $result = false) {
		$route = Router::getRoute();
		if (isset($route[$num])) {
			$result = $route[$num];
		}

		return $result;
	}

	/**
	 * Get variable
	 */
	public function getVariable($variable, $result = false) {
		$routes = Router::getRoute();
		$found = false;
		foreach ($routes as $route) {
			if ($found) {
				$result = $route;
				break;
			} else if (Router::fixRoute($variable) == $route) {
				$found = true;
			}
		}

		return $result;
	}
}
